package poker;

/** KLASA CARD - POJEDYNCZA KARTY W TALII. */
public class Card {
	
  /** RANK - FIGURA KARTY.
   * SUIT - KOLOR KARTY. */
  private int rank, suit;
  
  /** TABLICA PRZECHOWUJACA KOLORY KART. */
  private static String[] suits = {"", "hearts", "spades", "diamonds", "clubs"};
  
  /** TABLICA PRZECHOWUJACA FIGURY KART. */
  private static String[] ranks = {"", "Ace", "2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Queen", "King"};

  /** METODA ZWRACA WARTOSC RANK JAKO NAPIS.
   * @param ODNOSNIK DO POLA TABELI RANKS.
   * @return CIAG ZNAKOW, OZNACZAJACY FIGURE KARTY. */
  public static String rankAsString(int nrRank) {
    if (nrRank == 14) { return ranks[1]; }
    return ranks[nrRank];
  }

  /** METODA ZWRACA FIGURE I KOLOR KARTY JAKO NAPIS. */
  public @Override String toString() {
    return ranks[rank] + " of " + suits[suit];
  }

  /** KONSTRUKTOR KLASY CARD.
   * @param SUIT - KOLOR KARTY.
   * @param RANK - FIGURA KARTY. */
  Card(int suit, int rank) {
    this.suit = suit;
	this.rank = rank;
  }

  /** METODA ZWRACA FIGURE KARTY. */
  public int getRank() {
    return rank;
  }

  /** METODA ZWRACA KOLOR KARTY. */
  public int getSuit() {
    return suit;
  }

}